package cn.msi.questionnaire.action;

import cn.common.action.GeneralAction;
import cn.msi.questionnaire.domain.Naire;
import cn.msi.questionnaire.service.NaireService;

/**
 * 问卷管理请求Action
 * 
 * @author Administrator
 * 
 */
public class NaireAction extends GeneralAction {

	private static final long serialVersionUID = 5941665076045213603L;

	private Naire naire = new Naire();

	private NaireService naireService;

	private String indexText;

	private String[] questionText;

	/**
	 * 问卷管理主界面
	 * 
	 * @return
	 * @throws Exception
	 */
	public String naireIndex() throws Exception {
		return SUCCESS;
	}

	/**
	 * 查询项目问卷
	 * 
	 * @throws Exception
	 */
	public void searchNaire() throws Exception {
		page(naire);
		String json = naireService.searchNaire(naire);
		out(json);
	}

	/**
	 * 打开问卷编辑界面
	 * 
	 * @return
	 * @throws Exception
	 */
	public String openNairePage() throws Exception {
		naire = naireService.openNairePage(naire);
		return SUCCESS;
	}

	/**
	 * 编辑问卷
	 * 
	 * @throws Exception
	 */
	public void editNaire() throws Exception {
		naireService.editNaire(naire, indexText, questionText);
	}

	/**
	 * 查找问卷内容
	 * 
	 * @throws Exception
	 */
	public void findNaireContent() throws Exception {
		String html = naireService.findNaireContent(naire);
		out(html);
	}

	/**
	 * 问卷作废
	 * 
	 * @throws Exception
	 */
	public void invalidNaire() throws Exception {
		naireService.invalidNaire(naire);
	}

	/**
	 * 问卷一审
	 * 
	 * @throws Exception
	 */
	public void firstAutNaire() throws Exception {
		naireService.firstAutNaire(naire);
	}

	/**
	 * 问卷二审
	 * 
	 * @throws Exception
	 */
	public void secondAutNaire() throws Exception {
		naireService.secondAutNaire(naire);
	}

	public Naire getNaire() {
		return naire;
	}

	public void setNaire(Naire naire) {
		this.naire = naire;
	}

	public void setNaireService(NaireService naireService) {
		this.naireService = naireService;
	}

	public String getIndexText() {
		return indexText;
	}

	public void setIndexText(String indexText) {
		this.indexText = indexText;
	}

	public String[] getQuestionText() {
		return questionText;
	}

	public void setQuestionText(String[] questionText) {
		this.questionText = questionText;
	}
}
